A software program may be tested prior to release of a product (e.g. a software product and/or a hardware device) that may execute the software program. Code coverage may measure a degree to which the source code of the software program has been tested. For example, a code coverage tool may generate a report that may indicate which parts of the source code were executed during a testing of the software program. This information may be used for determining which portions of the software program may not have been executed. If a product is released with some parts of the software program that were never executed during testing, there may be a likelihood that the software program may fail due to software bugs that may exist in the untested parts of the software program.
Code coverage may be determined using host-based methods, which may simulate a hardware abstraction layer. In other words, code coverage may be determined using a tool (e.g. GCov, BullsEye, etc.) that may simulate a model of a target hardware peripheral device so that the source code of a software program may be executed on a host machine without using a hardware device (e.g. a hardware reference board). The source code of the software program may include target-dependent code, which may be tested using the simulated hardware abstraction layer.
Whilst a host-based method for determining code coverage may provide a convenience of testing a source code of a software program without a need of a hardware device, the code coverage determined from such a method may depend on how well the hardware abstraction layer is simulated. For example, as described above, the source code of the software program may include target-dependent code, and testing of the target-dependent code may depend on how well the hardware abstraction layer is simulated.
Furthermore, a host-based method for determining code coverage may not provide an accurate indication of how the source code of the software program may actually be executed in a hardware device. In other words, the real coverage of the source code in the hardware device may not be known.
New ways of determining code coverage of a source code of a software program may be needed.